package cn.com.ayqu.module.erp.dal.mysql.activity;

import java.util.*;

import cn.com.ayqu.framework.common.pojo.PageResult;
import cn.com.ayqu.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.com.ayqu.framework.mybatis.core.mapper.BaseMapperX;
import cn.com.ayqu.module.erp.dal.dataobject.activity.ActivityDO;
import org.apache.ibatis.annotations.Mapper;
import cn.com.ayqu.module.erp.controller.admin.activity.vo.*;

/**
 * 活动列表 Mapper
 *
 * @author 高连杰
 */
@Mapper
public interface ActivityMapper extends BaseMapperX<ActivityDO> {

    default PageResult<ActivityDO> selectPage(ActivityPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ActivityDO>()
                .likeIfPresent(ActivityDO::getActivityName, reqVO.getActivityName())
                .eqIfPresent(ActivityDO::getActivityDesc, reqVO.getActivityDesc())
                .betweenIfPresent(ActivityDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(ActivityDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(ActivityDO::getIsShow, reqVO.getIsShow())
                .betweenIfPresent(ActivityDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ActivityDO::getId));
    }

}